<?php

function downloadFile(){
    $url = "https://onlyoffice.xzdream.cn:9010/cache/files/683188517_5412/output.docx/output.docx?md5=fLd93v5qjis-BAhSFN1ouQ&expires=1660621381&filename=output.docx";
    $ext = '0007.docx';
    $tmp_path = "E:/php_project/php_demo/curl/";
    $output = $tmp_path.$ext;
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    $file = curl_exec($ch);
    curl_close($ch);
    if(file_put_contents($output, $file)) {
        return $output;
    }
    curl_close($ch);
    return false;
}

echo downloadFile();
